<?php
my_component_load('testing' , false);
my_component_load('paging' , false); 
my_component_load('data_setting', false);
my_component_load('hubungan_keluarga' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$modulname = "Admin _BN_ Konfigurasi Data _BN_ Bank";

if($_SERVER['REQUEST_METHOD'] == "POST" ):
    $validatepost = form_hubungan_keluarga_validate();
	switch($task){
		case   "editpage" :
			if($validatepost)
			{
				$errors = message_multi_error($validatepost);
				$content = $errors;
				$content .= form_hk_create($id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
					form_hk_submit($id);
					$content =  "Updated";
					generate_my_web($content,"","plain.php");
					exit;
			     }
		break; 
	}

else: 	
	if($task == "edit"){
		$title= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com='.$_GET['com'].'&task=editpage&id='.$id , $title , 150	); 
	}elseif($task == "editpage"){ 
		$content  = form_hk_create($id);
		generate_my_web($content,"","plain.php");
		exit; 
	}elseif($task == 'delete'){ // DELETE ITEM	
		remove_hk($id);
		my_direct('index.php?com='.$_GET['com']);
	}else{
		$pagename = "Daftar hubungan keluarga";
		load_facebox_script();
		$view =  list_hubungan_keluarga(); 
		
	}
endif; 
$content = spliter_browser( $view , $pagename ,'index.php?com=hubungan_keluarga&task=edit');
generate_my_web($content, $modulname );